﻿@model PicStore.Web.Models.User.EditUserModel
@{
    Layout = null;
}

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/Javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Ajax.BeginForm((string)ViewBag.Action, "User", null, new AjaxOptions { HttpMethod = "Post", OnSuccess = (string)ViewBag.OnSuccess }, new { @class = "form-horizontal" }))
{
    <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
        <h3>Edit User</h3>
    </div>
    
    @Html.ValidationSummary(true)
    <div class="modal-body">
        <div class="control-group">
            @Html.HiddenFor(model => model.Id)
            @Html.LabelFor(model => model.UserName, new { @class = "control-label" })
            <div class="controls">
                @Html.DisplayFor(model => model.UserName)<br/>
            </div>
        </div>

        <div class="control-group">
            @Html.LabelFor(model => model.Email, new { @class = "control-label" })
            <div class="controls">
                @Html.EditorFor(model => model.Email)<br/>
                @Html.ValidationMessageFor(model => model.Email)
            </div>
        </div>
        
        <div class="control-group">
            @Html.LabelFor(model => model.Department, new { @class = "control-label" })
            <div class="controls">
                @Html.EditorFor(model => model.Department)<br/>
                @Html.ValidationMessageFor(model => model.Department)
            </div>
        </div>
        
        <div class="control-group">
            @Html.LabelFor(model => model.Phone, new { @class = "control-label" })
            <div class="controls">
                @Html.EditorFor(model => model.Phone)<br/>
                @Html.ValidationMessageFor(model => model.Phone)
            </div>
        </div>
        
        <div class="control-group">
            @Html.LabelFor(model => model.Mobile, new { @class = "control-label" })
            <div class="controls">
                @Html.EditorFor(model => model.Mobile)<br/>
                @Html.ValidationMessageFor(model => model.Mobile)
            </div>
        </div>

        <div class="control-group">
            @Html.LabelFor(model => model.RoleId, new { @class = "control-label" })
            <div class="controls">
                @Html.DropDownListFor(m => m.RoleId, Model.RoleList)<br/>
                @Html.ValidationMessageFor(model => model.RoleId)
            </div>
        </div>
    </div>

    <div class="modal-footer">
        <a href="#" class="btn" data-dismiss="modal">Close</a>
        <input type="submit" class="btn btn-primary" value="Save" />
    </div>
}
@*<script type="text/javascript">
    $.validator.unobtrusive.parse(document);
</script>*@
